
#ifndef _M_DEV_USART_H_
#define _M_DEV_USART_H_

#include <stm32f10x.h>

#define USART_TRUE        1
#define USART_FLASE       0

#define USART_TBUF_SIZE   256
#define USART_RBUF_SIZE   256

struct buf_st {
  unsigned char ucIn;                        /* Next In Index   */
  unsigned char ucOut;                       /* Next Out Index  */
  unsigned char ucBuf [USART_RBUF_SIZE];     /* Buffer          */
};

enum USART_RET{
  USART_OK = 0,
  USART_BUSY = 1,
  USART_ERR = -1,
};

void uart1_dev_init(uint32_t uiBaudRate,
                uint16_t usWordLength,
                uint16_t usStopBits,
                uint16_t usParity,
                uint16_t usCtx);

void uart2_dev_init(uint32_t uiBaudRate,
                uint16_t usWordLength,
                uint16_t usStopBits,
                uint16_t usParity,
                uint16_t usCtx);

void uart3_dev_init(uint32_t uiBaudRate,
                uint16_t usWordLength,
                uint16_t usStopBits,
                uint16_t usParity,
                uint16_t usCtx);

#endif

